package com.fruit.mapper.order;

import java.util.List;
import java.util.Map;

import com.fruit.pojo.order.Order;
import com.fruit.pojo.order.OrderConfig;
import com.fruit.pojo.order.OrderException;
import com.fruit.pojo.order.OrderGoods;
import com.fruit.pojo.order.TransactionException;
import com.fruit.pojo.user.MyFruitTree;
import com.fruit.pojo.user.UserAction;

public interface OrderMapper {


	/**
	 * 通过交易流水获取订单信息
	 * @param transactionId
	 * @return
	 * @author admin
	 * @version 2017
	 */
	Order getOrderByTransactionId(long transactionId);
	
	/**
	 * 修改订单状态
	 * @param order
	 * @return
	 * @author admin
	 * @version 2017
	 */
	int updateOrderStateById(Order order);
	
	/**
	 * 获取订单商品信息
	 * @param orderId
	 * @return
	 * @author admin
	 * @version 2017
	 */
	List<OrderGoods> getOrderGoodsByOrderId(long orderId);
	
	/**
	 * 修改商品实际库存
	 * @param og
	 * @return
	 * @author admin
	 * @version 2017
	 */
	int updateGoodsSpecRealStockNum(OrderGoods og);
	
	/**
	 * 获取订单信息
	 * @param id
	 * @return
	 * @author admin
	 * @version 2017
	 */
	Order getOrderById(long id);
	
	/**
	 * 获取订单配置信息
	 * @return
	 * @author admin
	 * @version 2017
	 */
	List<OrderConfig> getOrderConfig();
	
	/**
	 * 新增我的果树
	 * @param mft
	 * @return
	 * @author admin
	 * @version 2017
	 */
	int saveMyFruitTree(MyFruitTree mft);
	
	/**
	 * 修改果树CODE编号
	 * @param mft
	 * @return
	 * @author admin
	 * @version 2017
	 */
	int updateMyFruitTreeCode(MyFruitTree mft);
	
	/**
	 * 新增我的行为
	 * @param ua
	 * @return
	 * @author admin
	 * @version 2017
	 */
	int saveUserAction(UserAction ua);
	
	/**
	 * 新增订单异常记录
	 * @param oe
	 * @return
	 * @author admin
	 * @version 2017
	 */
	int saveExceptionOrder(OrderException oe);
	
	/**
	 * 新增交易流水异常记录
	 * @param oe
	 * @return
	 * @author admin
	 * @version 2017
	 */
	int saveExceptionTransaction(TransactionException oe);
	
	/**
	 * 通过用户ID和订单状态获取订单数量
	 * @param params
	 * @return
	 * @author admin
	 * @version 2017
	 */
	int getOrderCntByUserId(Map<String, Object> params);
}
